/*
 * Copyright (c) 2011-2014, fortiss GmbH.
 * Licensed under the Apache License, Version 2.0.
 *
 * Use, modification and distribution are subject to the terms specified
 * in the accompanying license file LICENSE.txt located at the root directory
 * of this software distribution. A copy is available at
 * http://chromosome.fortiss.org/.
 *
 * This file is part of CHROMOSOME.
 *
 * $Id: printResponseFunction.c 7805 2014-03-13 09:54:35Z geisinger $
 */

/**
 * \file
 *         Source file for function printResponse in component client.
 *
 * \author
 *         This file has been generated by the CHROMOSOME Modeling Tool (XMT)
 *         (fortiss GmbH).
 */

/******************************************************************************/
/***   Includes                                                             ***/
/******************************************************************************/
#include "calculator/adv/client/include/printResponseFunction.h"

#include "calculator/adv/client/include/printResponseFunctionWrapper.h"
#include "calculator/adv/client/include/clientComponent.h"
#include "calculator/adv/client/include/clientComponentWrapper.h"
#include "calculator/adv/client/include/clientManifest.h"

#include "xme/core/logUtils.h"

#include "xme/hal/include/mem.h"

// PROTECTED REGION ID(CALCULATOR_ADV_CLIENT_PRINTRESPONSEFUNCTION_C_INCLUDES) ENABLED START

// PROTECTED REGION END

/******************************************************************************/
/***   Definitions                                                          ***/
/******************************************************************************/

// PROTECTED REGION ID(CALCULATOR_ADV_CLIENT_PRINTRESPONSEFUNCTION_C_DEFINITIONS) ENABLED START

// PROTECTED REGION END

/******************************************************************************/
/***   Variables                                                            ***/
/******************************************************************************/

// PROTECTED REGION ID(CALCULATOR_ADV_CLIENT_PRINTRESPONSEFUNCTION_C_VARIABLES) ENABLED START

// PROTECTED REGION END

/******************************************************************************/
/***   Prototypes                                                           ***/
/******************************************************************************/

// PROTECTED REGION ID(CALCULATOR_ADV_CLIENT_PRINTRESPONSEFUNCTION_C_PROTOTYPES) ENABLED START

// PROTECTED REGION END

/******************************************************************************/
/***   Implementation                                                       ***/
/******************************************************************************/
xme_status_t
calculator_adv_client_printResponseFunction_init
(
    calculator_adv_client_clientComponent_config_t* const componentConfig
)
{
    // PROTECTED REGION ID(CALCULATOR_ADV_CLIENT_PRINTRESPONSEFUNCTION_INITIALIZE_C) ENABLED START
    
    // Nothing to do
    
    XME_UNUSED_PARAMETER(componentConfig);
    
    return XME_STATUS_SUCCESS;
    
    // PROTECTED REGION END
}

void
calculator_adv_client_printResponseFunction_step
(
    calculator_adv_client_clientComponent_config_t* const componentConfig
)
{
    xme_status_t status[1];
    
    calculator_topic_calculatorResponse_t portClientResponseData; // Required port.
    
    (void)xme_hal_mem_set(&portClientResponseData, 0u, sizeof(calculator_topic_calculatorResponse_t));
    
    status[0] = calculator_adv_client_clientComponentWrapper_readPortClientResponse(&portClientResponseData);
    
    {
        // PROTECTED REGION ID(CALCULATOR_ADV_CLIENT_PRINTRESPONSEFUNCTION_STEP_C) ENABLED START

        XME_UNUSED_PARAMETER(componentConfig);

        if (XME_STATUS_SUCCESS == status[0])
        {
            // We received a response
            XME_LOG(XME_LOG_ALWAYS, "Calculator response: %f\n", portClientResponseData.result);
        }

        // PROTECTED REGION END
    }
    
    {
        // PROTECTED REGION ID(CALCULATOR_ADV_CLIENT_PRINTRESPONSEFUNCTION_STEP_2_C) ENABLED START
    
        // Nothing to do
    
        // PROTECTED REGION END
    }
}

void
calculator_adv_client_printResponseFunction_fini
(
    calculator_adv_client_clientComponent_config_t* const componentConfig
)
{
    // PROTECTED REGION ID(CALCULATOR_ADV_CLIENT_PRINTRESPONSEFUNCTION_TERMINATE_C) ENABLED START
    
    // Nothing to do
    
    XME_UNUSED_PARAMETER(componentConfig);
    
    // PROTECTED REGION END
}

// PROTECTED REGION ID(CALCULATOR_ADV_CLIENT_PRINTRESPONSEFUNCTION_IMPLEMENTATION_C) ENABLED START

// PROTECTED REGION END
